//
//  My_ViewController.m
//  Bicycle
//
//  Created by dllo on 16/4/26.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "My_ViewController.h"
#import "SettingViewController.h"
@interface My_ViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic, strong) UITableView *tableView;
@property(nonatomic, strong) NSMutableDictionary *dic;

@end

@implementation My_ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.view.backgroundColor=[UIColor yellowColor];
    [self createTable];
    UIView *headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen]bounds].size.width, 130)];
    headerView.backgroundColor = [UIColor cyanColor];
    self.tableView.tableHeaderView = headerView;
    self.tableView.tableFooterView = [[UIView alloc]init];
}
//设置
- (void)push{
    SettingViewController *set = [[SettingViewController alloc]init];
    
    [self.navigationController pushViewController:set animated:YES];
}

//创建tableView
- (void)createTable{
    self.tableView  = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen]bounds].size.width, [[UIScreen mainScreen]bounds].size.height) style:UITableViewStylePlain];
    self.tableView.dataSource = self;
    self.tableView.delegate = self;
    [self.view addSubview:self.tableView];
}
//行数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:
(NSInteger)section{
    return 1;
}
//分区数
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 3;
}
//分区头高
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    return 10;
}
//样式 赋值
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:nil];
    if (indexPath.section == 0) {
        self.tableView.rowHeight = 44;
        cell.textLabel.text = @"记录";
    }else if (indexPath.section == 1){
        self.tableView.rowHeight = 250;
    }else if (indexPath.section == 2){
        self.tableView.rowHeight = 44;
        cell.textLabel.text = @"设置";
    }
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section == 0) {
        NSLog(@"你点我干啥");
    }else if (indexPath.section == 2){
        SettingViewController *set = [[SettingViewController alloc]init];
        
        [self.navigationController pushViewController:set animated:YES];
    }
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
